package Legend.Grps is

   type Group_File_Type is tagged limited record
      Index_File          : Stream_IO.File_Type;
      Index_Stream        : Stream_IO.Stream_Access;
      Index_Size          : Stream_IO.Count;
      Data_File           : Stream_IO.File_Type;
      Index_Count         : Uint16_t;
      Data_Stream         : Stream_IO.Stream_Access;
      Data_Size           : Stream_IO.Count;
      Next_Data_Offset    : Stream_IO.Count;
      Current_Data_Offset : Stream_IO.Count;
      Block_Size          : Stream_IO.Count;
   end record;

   procedure Open (
      this       : in out Group_File_Type;
      Index_File : String;
      Data_File  : String;
      Readonly   : Boolean := True
      );

   procedure Set_Writable (this : in out Group_File_Type);

   -- move to next index
   procedure Next_Block (this : in out Group_File_Type);

   procedure Set_Block_Index (
      this  : in out Group_File_Type; 
      Index : Uint16_t
      );

   function End_Of_Data (this : Group_File_Type) return Boolean;

   procedure Close (this : in out Group_File_Type);

end Legend.Grps;
